package cn.intotw.rdcj.flash.controller;


import cn.intotw.rdcj.core.bean.DataResponse;
import cn.intotw.rdcj.core.constant.Constants;
import cn.intotw.rdcj.goods.dto.GoodsReduceReqVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.validation.Valid;

/**
 * @author Chenxiang
 * @Description: 下单接口类
 * @create 2020/4/9 11:02
 * @see cn.intotw.rdcj.goods.api.RdcjGoodsApi
 */
@RestController
@RequestMapping("/rdcj/goods")
@Api(value = "/rdcj/goods", tags = {"goodsTag"})
@Slf4j
public class GoodsApiController {

    /**
     * @see cn.intotw.rdcj.goods.api.RdcjGoodsApi#goodsReduce(GoodsReduceReqVo)
     **/
    @ApiOperation(value = "Api-扣减库存接口", notes = "Api-扣减库存接口")
    @PostMapping("/v1/reduce")
    public ModelAndView goodsReduce(@RequestBody @Valid @ApiParam(name = "订单信息", value = "传入json格式",
            required = true) GoodsReduceReqVo goodsReduceReqVo) {
        log.info("hello--------------------------------------------");
        return new ModelAndView(Constants.JSON_DATA_VIEW, DataResponse.successWithResult(goodsReduceReqVo));
    }
}